package cn.gailvlun.gll.presentation.emotion.core

import android.content.Context
import cn.gailvlun.gll.net.emotion.Emotion
import com.github.markzhai.recyclerview.MultiTypeAdapter


open class BaseAdapter<T : Any> : MultiTypeAdapter {

    constructor(context: Context?) : super(context)
    constructor(context: Context?, viewTypeToLayoutMap: MutableMap<Int, Int>?) : super(context, viewTypeToLayoutMap)


    fun getData(): MutableList<Any> {
        return mCollection
    }

    open fun remove(certainItem: T?) {
        if (certainItem == null) {
            return
        }

        for (i in 0 until itemCount) {


            if (mCollection[i] is Emotion) {
                val whichItem = mCollection[i] as? T
                if (whichItem != null) {

                    if (removeCondition(whichItem, certainItem)) {


                        remove(i)
                        break

                    }
                }
            }
        }
    }

    open fun removeCondition(whichItem: T, certainItem: T): Boolean {
        return false
    }

    
















    @Deprecated("it is useless", ReplaceWith("false"))
    open fun notifyItemChangedCondition(whichItem: T, certainItem: T): Boolean {
        return false
    }

}